import { create } from 'zustand';

interface UseCmdStore {
  mutualExclusion: { [key: string]: string }; // 互斥组
  independent: string[]; // 独立组
  cmdParams: { [key: string]: any };
  setMutualExclusion: (newMutualExclusion: { [key: string]: string }) => void;
  setIndependent: (newIndependent: string[]) => void;
  setCmdParams: (newCmdParams: { [key: string]: any }) => void;
}

export const useCmdStore = create<UseCmdStore>()((set) => ({
  independent: [],
  mutualExclusion: {}, // 默认值
  cmdParams: {}, // 默认值
  setMutualExclusion: (newMutual) => set({ mutualExclusion: newMutual }),
  setIndependent: (newIndependent) => set({ independent: newIndependent }),
  setCmdParams: (newCmdParams) => set({ cmdParams: newCmdParams }),
}));
